//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package location;

public class LogicTimer {
  private int subticks;

  public LogicTimer() {
    this.reset();
  }

  public void reset() {
    this.subticks = 0;
  }

  public void startTimer(int ticksLeft, int ticksNow) {
    this.subticks = ticksLeft * 2 + ticksNow + 31;
  }

  public int getRemainingSeconds(int ticksNow) {
    int diff = this.subticks - ticksNow;
    if(diff > 0) {
      float seconds = (float)diff / 30.3F;
      return Math.round(seconds);
    } else {
      return 0;
    }
  }

  public int getTicksLeft(int ticksNow) {
    return (this.subticks - ticksNow) / 2;
  }

  public boolean isStarted() {
    return this.subticks > 0;
  }

  public int getSubticks() {
    return this.subticks;
  }
}
